package com.wasion.pwportable.protocol.analyzer.terminal;

import com.wasion.pwportable.protocol.Protocol;
import com.wasion.pwportable.protocol.Result;
import com.wasion.pwportable.protocol.analyzer.AbstractAnalyzer;

public class NetWork_Status_Analyzer extends AbstractAnalyzer {

	@Override
	public void dataAnalysis(String ackBS) {

		// result result = new result();
		String dataType = ackBS.substring(DATATPYESTARTBIT, DATATPYENDBIT);

		//String dataLen = ackBS.substring(DATALENGTHSTARTBIT, DATALENGTHENDBIT); // 16进制的数据长度

		if (dataType.equalsIgnoreCase(Protocol.NETWORK_STATUS)) {
			String data = ackBS.substring(DATABITSTART, DATABITSTART + 2);

			if (data.equalsIgnoreCase("01"))
				result.setNetWorkStatus(Result.nwkStatus[1]);
			else if (data.equalsIgnoreCase("02"))
				result.setNetWorkStatus(Result.nwkStatus[2]);
			else if (data.equalsIgnoreCase("03"))
				result.setNetWorkStatus(Result.nwkStatus[3]);
		} else
			result.setNetWorkStatus(Result.nwkStatus[0]);

	}

}
